#include <iostream>
#include <cstdio>
#include <sstream>
#include <string>
using namespace std;

long long power(int a, int b) {
	if (b == 0) return 1;
	if (b == 1) return a;
	long long sub = power(a, b / 2);
	if (b % 2 == 1) return sub * sub * a;
	else return sub * sub;
}

string expr;
stringstream ss;

int main() {
	cin >> expr;
	if (expr[0] == '-') ss << "0";
	ss << expr << "@1";
	bool isadd = 1;
	bool ismul = 1;
	long long ans = 0;
	long long mulres = 1, facres = 1, b;
	char e;
	ss >> facres;
	while (1) {
		ss >> e >> b;
		switch (e) {
			case '@':
				goto CALC;
				break;
			case '+':
			case '-':
				if (ismul) {
					mulres *= facres;
				} else {
					mulres /= facres;
				}

				if (isadd) {
					ans += mulres;
				} else {
					ans -= mulres;
				}

				if (e == '+') {
					isadd = 1;
				} else {
					isadd = 0;
				}

				ismul = 1;
				mulres = 1;
				facres = b;
				break;

			case '*':
			case '/':
				if (ismul) {
					mulres *= facres;
				} else {
					mulres /= facres;
				}

				if (e == '*') {
					ismul = 1;
				} else {
					ismul = 0;
				}

				facres = b;
				break;

			case '^':
				facres = power(facres, b);
				break;

			default:
				break;
		}		
	}

	CALC:

	if (ismul) {
		mulres *= facres;
	} else {
		mulres /= facres;
	}

	if (isadd) {
		ans += mulres;
	} else {
		ans -= mulres;
	}

	cout << ans << endl;
	c
	return 0;
}